{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "b112f7f8",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "import torch\n",
    "x_data = torch.Tensor([[1.0], [2.0], [3.0], [4.0]])\n",
    "y_data = torch.Tensor([[2.0], [4.0], [6.0], [8.0]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "f58cc247",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "class LinearModel(torch.nn.Module):\n",
    "    def __init__(self):\n",
    "        super(LinearModel,self).__init__()\n",
    "        self.linear = torch.nn.Linear(1,1)\n",
    "    def forward(self,x):\n",
    "        y_pred = self.linear(x)\n",
    "        return y_pred\n",
    "Model = LinearModel()\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "4d17fe30",
   "metadata": {
    "scrolled": true,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "criterion = torch.nn.MSELoss(size_average = False)\n",
    "optimizer = torch.optim.SGD(Model.parameters(),lr = 0.01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "d3ea8f8f",
   "metadata": {
    "scrolled": true,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 tensor(116.7432, grad_fn=<MseLossBackward0>)\n",
      "1 tensor(13.0255, grad_fn=<MseLossBackward0>)\n",
      "2 tensor(1.5912, grad_fn=<MseLossBackward0>)\n",
      "3 tensor(0.3273, grad_fn=<MseLossBackward0>)\n",
      "4 tensor(0.1844, grad_fn=<MseLossBackward0>)\n",
      "5 tensor(0.1651, grad_fn=<MseLossBackward0>)\n",
      "6 tensor(0.1596, grad_fn=<MseLossBackward0>)\n",
      "7 tensor(0.1556, grad_fn=<MseLossBackward0>)\n",
      "8 tensor(0.1519, grad_fn=<MseLossBackward0>)\n",
      "9 tensor(0.1482, grad_fn=<MseLossBackward0>)\n",
      "10 tensor(0.1447, grad_fn=<MseLossBackward0>)\n",
      "11 tensor(0.1413, grad_fn=<MseLossBackward0>)\n",
      "12 tensor(0.1379, grad_fn=<MseLossBackward0>)\n",
      "13 tensor(0.1346, grad_fn=<MseLossBackward0>)\n",
      "14 tensor(0.1314, grad_fn=<MseLossBackward0>)\n",
      "15 tensor(0.1283, grad_fn=<MseLossBackward0>)\n",
      "16 tensor(0.1252, grad_fn=<MseLossBackward0>)\n",
      "17 tensor(0.1223, grad_fn=<MseLossBackward0>)\n",
      "18 tensor(0.1193, grad_fn=<MseLossBackward0>)\n",
      "19 tensor(0.1165, grad_fn=<MseLossBackward0>)\n",
      "20 tensor(0.1137, grad_fn=<MseLossBackward0>)\n",
      "21 tensor(0.1110, grad_fn=<MseLossBackward0>)\n",
      "22 tensor(0.1084, grad_fn=<MseLossBackward0>)\n",
      "23 tensor(0.1058, grad_fn=<MseLossBackward0>)\n",
      "24 tensor(0.1033, grad_fn=<MseLossBackward0>)\n",
      "25 tensor(0.1008, grad_fn=<MseLossBackward0>)\n",
      "26 tensor(0.0984, grad_fn=<MseLossBackward0>)\n",
      "27 tensor(0.0961, grad_fn=<MseLossBackward0>)\n",
      "28 tensor(0.0938, grad_fn=<MseLossBackward0>)\n",
      "29 tensor(0.0916, grad_fn=<MseLossBackward0>)\n",
      "30 tensor(0.0894, grad_fn=<MseLossBackward0>)\n",
      "31 tensor(0.0872, grad_fn=<MseLossBackward0>)\n",
      "32 tensor(0.0852, grad_fn=<MseLossBackward0>)\n",
      "33 tensor(0.0831, grad_fn=<MseLossBackward0>)\n",
      "34 tensor(0.0812, grad_fn=<MseLossBackward0>)\n",
      "35 tensor(0.0792, grad_fn=<MseLossBackward0>)\n",
      "36 tensor(0.0773, grad_fn=<MseLossBackward0>)\n",
      "37 tensor(0.0755, grad_fn=<MseLossBackward0>)\n",
      "38 tensor(0.0737, grad_fn=<MseLossBackward0>)\n",
      "39 tensor(0.0720, grad_fn=<MseLossBackward0>)\n",
      "40 tensor(0.0702, grad_fn=<MseLossBackward0>)\n",
      "41 tensor(0.0686, grad_fn=<MseLossBackward0>)\n",
      "42 tensor(0.0669, grad_fn=<MseLossBackward0>)\n",
      "43 tensor(0.0653, grad_fn=<MseLossBackward0>)\n",
      "44 tensor(0.0638, grad_fn=<MseLossBackward0>)\n",
      "45 tensor(0.0623, grad_fn=<MseLossBackward0>)\n",
      "46 tensor(0.0608, grad_fn=<MseLossBackward0>)\n",
      "47 tensor(0.0593, grad_fn=<MseLossBackward0>)\n",
      "48 tensor(0.0579, grad_fn=<MseLossBackward0>)\n",
      "49 tensor(0.0565, grad_fn=<MseLossBackward0>)\n",
      "50 tensor(0.0552, grad_fn=<MseLossBackward0>)\n",
      "51 tensor(0.0539, grad_fn=<MseLossBackward0>)\n",
      "52 tensor(0.0526, grad_fn=<MseLossBackward0>)\n",
      "53 tensor(0.0513, grad_fn=<MseLossBackward0>)\n",
      "54 tensor(0.0501, grad_fn=<MseLossBackward0>)\n",
      "55 tensor(0.0489, grad_fn=<MseLossBackward0>)\n",
      "56 tensor(0.0478, grad_fn=<MseLossBackward0>)\n",
      "57 tensor(0.0466, grad_fn=<MseLossBackward0>)\n",
      "58 tensor(0.0455, grad_fn=<MseLossBackward0>)\n",
      "59 tensor(0.0444, grad_fn=<MseLossBackward0>)\n",
      "60 tensor(0.0434, grad_fn=<MseLossBackward0>)\n",
      "61 tensor(0.0423, grad_fn=<MseLossBackward0>)\n",
      "62 tensor(0.0413, grad_fn=<MseLossBackward0>)\n",
      "63 tensor(0.0404, grad_fn=<MseLossBackward0>)\n",
      "64 tensor(0.0394, grad_fn=<MseLossBackward0>)\n",
      "65 tensor(0.0385, grad_fn=<MseLossBackward0>)\n",
      "66 tensor(0.0375, grad_fn=<MseLossBackward0>)\n",
      "67 tensor(0.0366, grad_fn=<MseLossBackward0>)\n",
      "68 tensor(0.0358, grad_fn=<MseLossBackward0>)\n",
      "69 tensor(0.0349, grad_fn=<MseLossBackward0>)\n",
      "70 tensor(0.0341, grad_fn=<MseLossBackward0>)\n",
      "71 tensor(0.0333, grad_fn=<MseLossBackward0>)\n",
      "72 tensor(0.0325, grad_fn=<MseLossBackward0>)\n",
      "73 tensor(0.0317, grad_fn=<MseLossBackward0>)\n",
      "74 tensor(0.0310, grad_fn=<MseLossBackward0>)\n",
      "75 tensor(0.0302, grad_fn=<MseLossBackward0>)\n",
      "76 tensor(0.0295, grad_fn=<MseLossBackward0>)\n",
      "77 tensor(0.0288, grad_fn=<MseLossBackward0>)\n",
      "78 tensor(0.0281, grad_fn=<MseLossBackward0>)\n",
      "79 tensor(0.0274, grad_fn=<MseLossBackward0>)\n",
      "80 tensor(0.0268, grad_fn=<MseLossBackward0>)\n",
      "81 tensor(0.0262, grad_fn=<MseLossBackward0>)\n",
      "82 tensor(0.0255, grad_fn=<MseLossBackward0>)\n",
      "83 tensor(0.0249, grad_fn=<MseLossBackward0>)\n",
      "84 tensor(0.0243, grad_fn=<MseLossBackward0>)\n",
      "85 tensor(0.0237, grad_fn=<MseLossBackward0>)\n",
      "86 tensor(0.0232, grad_fn=<MseLossBackward0>)\n",
      "87 tensor(0.0226, grad_fn=<MseLossBackward0>)\n",
      "88 tensor(0.0221, grad_fn=<MseLossBackward0>)\n",
      "89 tensor(0.0216, grad_fn=<MseLossBackward0>)\n",
      "90 tensor(0.0211, grad_fn=<MseLossBackward0>)\n",
      "91 tensor(0.0206, grad_fn=<MseLossBackward0>)\n",
      "92 tensor(0.0201, grad_fn=<MseLossBackward0>)\n",
      "93 tensor(0.0196, grad_fn=<MseLossBackward0>)\n",
      "94 tensor(0.0191, grad_fn=<MseLossBackward0>)\n",
      "95 tensor(0.0187, grad_fn=<MseLossBackward0>)\n",
      "96 tensor(0.0182, grad_fn=<MseLossBackward0>)\n",
      "97 tensor(0.0178, grad_fn=<MseLossBackward0>)\n",
      "98 tensor(0.0174, grad_fn=<MseLossBackward0>)\n",
      "99 tensor(0.0169, grad_fn=<MseLossBackward0>)\n"
     ]
    }
   ],
   "source": [
    "l = []\n",
    "n = []\n",
    "w = []\n",
    "b = []\n",
    "\n",
    "for epoch in range(100):\n",
    "    y_pre = Model(x_data)\n",
    "    loss = criterion(y_pre,y_data)\n",
    "    print(epoch, loss)\n",
    "    n.append(epoch)\n",
    "    l.append(loss.item())\n",
    "    w.append(Model.linear.weight.item())\n",
    "    b.append(Model.linear.bias.item())\n",
    "\n",
    "    optimizer.zero_grad()\n",
    "    loss.backward()\n",
    "    optimizer.step()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "6ea01aa4",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "w =  2.004164934158325\n",
      "b =  -0.012245122343301773\n"
     ]
    }
   ],
   "source": [
    "#输出weight bias\n",
    "print('w = ',Model.linear.weight.item())\n",
    "print('b = ',Model.linear.bias.item())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "db15459b",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAYgElEQVR4nO3df5DU9Z3n8eeLYWRWxeWHU8QwKpONP3CJRjP+IGRITrIVk01FU7E2emSDCYaqXDabdTfJmvOq1qvLVn5ghY13SSxOorgVXXKuOS0r5Z2HbgFVyDoQVAQUJEqGYBhQdA2rwPC+P/o7TPd09/z6dk/P9zuvR1VXd39/vr/zhde8+9M931ZEYGZm+TKp0QWYmVntOdzNzHLI4W5mlkMOdzOzHHK4m5nl0ORGFwBw5plnxpw5cxpdhplZpm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6rqdT6FLbgXcDp1E+dDEh1PL8Zjncx+ZLuMcBSc0Ugv1nEfFQMvl3fS/RkvsDjaqvThYAn5L0MoUht6spjEdPS166Q/7OeTfQHRGbkucPUgj7vJ/rjwK/joieiDgGPETh/Of5XBerdn5TZVyWw31CfAl3Ms68CtgRET8omvUIsCR5vAR4eKxrq6eI+FZEtEXEHArn9omIWAw8CVyfLJar446IV4HfSLogmbQI2E7OzzWF4ZirJJ2a/HvvO+7cnusBqp3fR4DPJ5+auQp4o2j4ZmgRkdkb8AngReAl4LZG11OnY/wQhZdpzwJbk9snKIw/rwV2Af8PmNHoWuv4M/gI8Gjy+D3AvwK7gf8FTGl0fTU+1vcDXcn5/t/A9IlwroH/CuwEtgH/CEzJ47kGHqDwvsIxCq/UllY7v4AofCLwJeA5Cp8mGva+fPkBM7McyvKwjJmZVeFwNzPLIYe7mVkOOdzNzHLI4W5mlkMOdzOzHHK4m5nl0P8Hr1zVvVEPdQYAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#画图\n",
    "import matplotlib.pyplot as plt\n",
    "plt.figure()\n",
    "plt.plot(n,l,color = 'black',linewidth = 2, label = 'loss')\n",
    "plt.plot(n, w, color = 'blue', linewidth = 2, label = 'w')\n",
    "plt.plot(n, b, color = 'orange', linewidth = 2, label = 'b')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9547f3ef",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pytorch",
   "language": "python",
   "name": "pytorch"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}